package com.hyg.oa.overtime.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hyg.oa.overtime.mapper.OvertimeMapper;
import com.hyg.oa.overtime.model.Overtime;

/**
 * 服务类
 * @author Administrator
 *
 */
@Service
@Transactional   
public class OvertimeService {

	@Autowired
	private OvertimeMapper mapper;
	
	/**
	 * 根据ID查询对象
	 * @param id
	 * @return
	 */
	public Overtime findById(String id) {
		return mapper.findById(id);
	}
	
	/**
	 * 查询列表
	 * @return
	 */
	public List<Overtime> findAll() {
		return mapper.findAll();
	}

	/**
	 * 保存
	 * @param overtime
	 */
	public void save(Overtime overtime) {
		this.mapper.save(overtime);
	}

	/**
	 * 更新
	 * @param overtime
	 */
	public void update(Overtime overtime) {
		this.mapper.update(overtime);
		
	}

	/**
	 * 删除
	 * @param id
	 */
	public void delete(String id) {
		this.mapper.delete(id);
	}
	
	/**
	 * 分页
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	public List<Overtime> findPage(int pageNo, int pageSize) {
		Map<String,Object> params = new HashMap<String, Object>(); 
		params.put("pageNo", pageNo);
		params.put("pageSize", pageSize);
		return this.mapper.findPage(params);
	}
	
	/**
	 * 分页，总数
	 * @return
	 */
	public Long findTotalCount() {
		return this.mapper.findTotalCount();
	}
}
